home *** CD-ROM | disk | FTP | other *** search
- **
- *
- * I/O Op Code 6 - RESTORE
- *
- * This routine will reset the file pointers. If the record
- * number is nonzero and the file was opened for relative
- * access, the file pointer will be set to the specified
- * record. Otherwise, it will reset to the beginning of
- * the file.
- *
- **
-
- REST0 ANDI R12,>FF00
- AI R12,24
-
- LDCR @B02,4
- BLWP @IFO Check to make sure file is open
- JEQ REST2
-
- REST1 BL @DSRERR
- DATA >0700 File error
-
- REST2
-
- * If file was open for output or append, error!
- *
- CB @56(R5),@B01
- JEQ REST1
-
- CB @56(R5),@B04
- JEQ REST1
-
- * If no record number is given, go to the beginning of the file
- *
-
- LDCR @ZERO,4
- MOV @PABBUF+6,R1
- JNE REST10
-
- * We will check to see if the 1st sector of the file is in
- * the buffer. If it is, we won't destroy it completely to
- * save reading the sector back in later.
- *
-
- LDCR @B02,4
- MOV @4(R5),R2 Get FDR address
- LDCR @2(R5),4
- MOV @40(R2),R10 Get 1st AU of file
- JEQ REST5
-
- LDCR @B02,4
- C R10,@50(R5)
- JNE REST5
- C @ZERO,@52(R5)
- JNE REST5
-
- REST3 MOV @6(R5),@54(R5) Reset pointer in buffer
- CLR @62(R5) Reset record number
- LDCR @2(R5),4 If variable length files,
- MOVB @12(R2),R3 set sector number to 1
- ANDI R3,>8000
- JEQ REST4
- LDCR @B02,4
- C @ZERO,@50(R5)
- JEQ REST4
- INC @62(R5)
- REST4 LDCR @ZERO,4
- B @DSRRT
-
- REST5 CLR @50(R5) Reset current AU
- CLR @52(R5) Reset sector within AU
- JMP REST3
-
- **
- *
- * Here we reset to a specific record number. Make sure
- * the file was opened for relative access, then position
- * to that record number.
- *
- * If the record isn't in the current buffer, we call FLUSH
- * to make sure we write out any updated information.
- *
- **
-
- REST10
- LDCR @B02,4 Select RAM bank 2
- MOVB @57(R5),R1 Check for relative access
- JNE REST11
-
- BL @DSRERR
- DATA >0700 File error
- REST11
- BL @POSIT Position the file pointer
- LDCR @ZERO,4
- B @DSRRT
-